package com.wongoing.base;


public class ResultData {
	private static ResultData instance;
	public synchronized static ResultData getInstance() {
		instance = null;
		if(instance == null) {
			instance = new ResultData();
		}
		return instance;
	}
	//业务是够成功的标志
	private boolean flag = true;
	//回传参数
	private Object obj = null;
	//回传消息
	private String msg = "数据获取成功";
	public boolean isFlag() {
		return flag;
	}
	public void setFlag(boolean flag) {
		this.flag = flag;
	}
	public Object getObj() {
		return obj;
	}
	public void setObj(Object obj) {
		this.obj = obj;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}

	public ResultData success(Object obj) {
		this.setObj(obj);
		return this;
	}
	
	public ResultData success(Object obj, String msg) {
		this.setObj(obj);
		this.setMsg(msg);
		return this;
	}
	
	public ResultData fail(Object obj) {
		this.setFlag(false);
		this.setMsg("获取数据失败");
		this.setObj(obj);
		return this;
	}
	
	public ResultData fail(Object obj, String msg) {
		this.setFlag(false);
		this.setMsg(msg);
		this.setObj(obj);
		return this;
	}

}
